﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class FindLinksTestPage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Submit_Click(object sender, EventArgs e)
    {
        String inputText = this.urlTextBox.Text;
        string[] newsTopics;
        if (inputText == null || inputText.Equals(""))
        {
            this.output.InnerText = "No Output Input is Empty";
            newsTopics = new String[0];
        }
        else
        {
            ZachmanServiceReference.Assignment3ServiceClient client = new ZachmanServiceReference.Assignment3ServiceClient();

            string[] urls = client.UrlsInPage(inputText);
            if (urls != null && urls.Length != 0)
            {
                string links = "";
                foreach (string url in urls)
                {
                    links += url;
                    links += ", ";
                }
                this.output.InnerText = links;
            }
            else
            {
                this.output.InnerText = "No Output :-(";
            }
        }
    }
}